package com.zerdoor.controller;

import com.zerdoor.service.RaceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

/**
 * Created by xiaoji on 2015/1/5.
 */
@Controller
@RequestMapping("/race")
public class RaceController {
    @Autowired
    private RaceService raceService;

    @RequestMapping("/index")
    public ModelAndView index(){
        ModelAndView modelAndView = new ModelAndView();
        //竞赛活动广告
        modelAndView.addObject("adverts",raceService.getRaceAdvert());
        //正在进行中的竞赛活动
        modelAndView.addObject("goingRace",raceService.getGoingRace());
        //正在进行中竞赛活动分组
        modelAndView.addObject("gointGroup",raceService.getGoingGroup());
        //完成中的竞赛活动
        modelAndView.addObject("finishGroup",raceService.getFinishRace());
        modelAndView.setViewName("/race/index");
        return modelAndView;
    }
}
